'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	let appid = "wxa12be3aa044494d5";//你自己的appid
	let secret = "012527a5282e57b69bda0760562e7549";//你自己的appsecret
	let url =
	"https://api.weixin.qq.com/sns/jscode2session?appid=" +
	appid +
	"&secret=" +
	secret +
	"&js_code=" +
	event.code +
	"&grant_type=authorization_code";
	let res = await uniCloud.httpclient.request(
		url ,// 请求路径,
		{
			dataType:"json"
		}
	);
	let openid = res.data.openid
	//返回数据给客户端
	return openid
};
